package dao.impl;

import java.util.List;

import org.hibernate.Query;

import bean.Meeting;
import dao.BaseHibernateDao;
import dao.MeetingDAO;

public class MeetingDAOImpl extends BaseHibernateDao implements MeetingDAO {

	public void save(Meeting meeting) {
		super.add(meeting);
	}

	public void update(Meeting meeting) {
		super.update(meeting);
	}

	public void delete(int mid) {
		super.del(mid, Meeting.class);
	}

	public List<Meeting> findAll() {
		Meeting meeting=new Meeting();
		return super.search(meeting, Meeting.class);
	}

	public List<Meeting> findByProperty(String propertyName, Object value) {
		String hql = "from Meeting as m where m." + propertyName + " like ?";
		Query query = getSession().createQuery(hql);
		query.setParameter(0, "%" + value + "%");
		return query.list();
	}

	public Meeting getMeetingBymid(int mid) {
		// TODO Auto-generated method stub
		return (Meeting) super.load(mid, Meeting.class);
	}

	public Meeting getMeetingBytopic(String topic) {
		// TODO Auto-generated method stub
		return (Meeting) super.findObjectByProperty(topic, null, Meeting.class);
	}

	public List<Meeting> getMeetingBydepName(String depName) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Meeting> findByPage(Integer pageIndex, Integer pageSize,
			String hql) {
		// TODO Auto-generated method stub
		return null;
	}

//	public List<Meeting> getMeetingByparticipants(String participants) {
//		// TODO Auto-generated method stub
//		return super.findObjectByProperty(participants, null, Meeting.class);
//	}
//
//	public List<Meeting> getMeetingBytype(String type) {
//		// TODO Auto-generated method stub
//		return null;
//	}
//
//	public List<Meeting> getMeetingBymeetingState(String meetingState) {
//		// TODO Auto-generated method stub
//		return null;
//	}

}
